import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const store = new Vuex.Store({
  state: {      // 定义共享状态
    circleselectionstatus: 0, //圈选未圈选状态
    examId:''
  },
  mutations: {  // 同步修改状态
    setCircleselectionstatus(state, status) {
      state.circleselectionstatus = status;
    },
    setExamId(state, examId) {
      state.examId = examId;
    }
  },
  actions: {    // 异步操作
    updateCircleselectionstatus({ commit }, status) {
      commit('setCircleselectionstatus', status);
    },
    updateExamId({ commit }, examId) {
      commit('setExamId', examId);
    }
  },
  getters: { 
    getExamidstatus(state) {
      return state.examId;
    }
  }
})

export default store